Why glibc 2.34 removed libpthread

您所在的位置:网站首页 centos7 cmake pthread Why glibc 2.34 removed libpthread

Why glibc 2.34 removed libpthread

2023-11-19 10:15| 来源: 网络整理| 查看: 265

The recent 2.34 release of the GNU C library, glibc, removes libpthread as a separate library. This article explains the motivation behind this change and some consequences for developers and system administrators.

For a long time, glibc was split into multiple, separate, shared objects. For example, the threading library libpthread was contained in a shared object libpthread.so.0, and the application interface for the dynamic linker, libdl, in the file libdl.so.2. There was even a time, some twenty years ago, when there were two separate implementations of libpthread, the LinuxThreads implementation for Linux 2.4 and earlier and the Native POSIX Threads Library (NPTL) implementation for Linux 2.6 and later.

In the glibc 2.34 release, we have integrated most components that used to be in separate shared objects into the main libc object, libc.so.6. These changes have been implemented in a backward-compatible fashion, so even though libpthread is gone as a separate object, all the public functions it used to provide (such as pthread_create) are still available. In this consolidation effort, glibc follows the pioneering work of the musl C library, which provides absolutely everything (including the dynamic linker) in a single shared object.

The developer view

A textbook "Hello, world!" example using C++ threads look like this:

#include #include int main() { std::thread thr{[]() { std::cout


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3